package top.humbleyuan.java8.function;

import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * @Author HumbleYuan
 * @Date 2020/1/3 14:03
 * @Des 四大函数式接口
 */
public class FunctionDemo {
    public static void main(String[] args) {
        Function<String, Integer> func = str -> {
            return 1024;
        };

        func.apply("ha");


        Predicate<String> predicate = str -> {
            return str.isEmpty();
        };

        predicate.test("ha");


        Consumer<String> consumer = str -> {
            System.out.println(str);
        };

        consumer.accept("la");

        Supplier<String> supplier = () -> {
            return "la";
        };

        supplier.get();
    }
}
